<?php

/*----------------------------------------------+
|  MaxForum					|
|  ===========================================	|
|  By Majd Almontaser				|
|  Released under the License GNU v3.0		|
|  http://www.Max4Dev.com			|
|  ===========================================	|
|  Ttmtt Team - http://www.liioiil.com		|
+-----------------------------------------------*/

error_reporting(E_ALL ^ E_NOTICE);

/**
* This be the gallery control file, basically
* decides what page to show.
**/

# Get gallery settings
$query = mysql_query('SELECT * FROM ' . $db_prefix . 'gallery_settings');
$row = mysql_fetch_assoc($query);

	$gallery['settings'] = $row;

# Create the gallery object to deal with the main stuff.
require 'includes/pages/gallery/classes/core.php';
$Gallery = new Gallery($gallery);

# Load lang
@include 'language/' . $board_lang . '';
@include 'language/' . $board_lang . '.php';

# Lets make sure they have permission to view the gallery
if ($gallery['permissions']['access'] != 1) max_redirect('index.php?page=error&error', 'error');

# Run default template hooks
$Gallery->template('pages/gallery.template.php')->hook('start', 1, 2);

if (isset($_GET['act']) && $_GET['act'] != '' && file_exists('includes/pages/gallery/' . $_GET['act'] . '.php')){

	include 'gallery/' . $_GET['act'] . '.php';

}else
{

	include 'gallery/home.php';
}
# last hooks
$Gallery->template('pages/gallery.template.php')->hook(3, 'end');
?>
